﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProjectCommonLibs.utils
{
    public class DataCheckUtils
    {
        public static bool isAllDataZero(List<long> data)
        {
            return data.All(num =>
            {
                return num == 0;
            });
        }

        public static bool isAnyDataZero(List<long> data)
        {
            return data.Any(num => num == 0);
        }

        public static bool containsError(List<long> dataToBeChecked,long[] threshoulds)
        {
            if (dataToBeChecked.Count != threshoulds.Length)
            {
                throw new Exception("两个列表的长度不一致");
            }
            
            for (int i = 0; i < dataToBeChecked.Count; i++)
            {
                if (Math.Abs(dataToBeChecked[i]) > threshoulds[i])
                {
                    return true;
                }
            }
            return false;
        }
    }
}
